<template>
	<div class="layout-pd">
		<section v-show="!status">
			<el-card shadow="hover">
				<el-form :model="state.param"  label-width="100px">
					<el-row :gutter="35">
						<el-col :xs="22" :sm="22" :md="22" :lg="22" :xl="22">
							<el-row :gutter="35">
								<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb20">
									<el-form-item label="选择门店">
										<el-select v-model="state.param.store" placeholder="请选择门店" class="w100">
											<el-option v-for="item in state.query.storeList" :key="item.id"
												:label="item.name" :value="item.id" />
										</el-select>
									</el-form-item>
								</el-col>

								<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb20">
									<el-form-item label="退款状态">
										<el-select v-model="state.param.refundStatus" placeholder="请选择退款状态" class="w100">
											<el-option v-for="item in state.query.refundStatus" :key="item.value"
												:label="item.label" :value="item.value" />
										</el-select>
									</el-form-item>
								</el-col>

								
							</el-row>
						</el-col>
						<el-col :xs="2" :sm="2" :md="2" :lg="2" :xl="2" class="screenMenu">
							<el-button type="primary" @click="search">
								<SvgIcon name="iconfont icon-biaodan" /> 搜 索
							</el-button>
						</el-col>
					</el-row>
				</el-form>
			</el-card>

			<el-card shadow="hover" class="mt15" v-loading="state.loading">
				<el-table :data="state.tableData" style="width: 100%"> 
					<el-table-column label="退款编号" prop="cardItemName" show-overflow-tooltip width="120">
						<template #default="scope">
							<el-link type="danger" :underline="true" @click="previewOrderInfo(scope.row)">YX588774564561</el-link>
						</template>
					</el-table-column>
					<el-table-column label="会员名" prop="cellPrice" />
					<el-table-column label="商品名" prop="orderPrice" />
					<el-table-column label="商品类型" prop="cellPrice" />
					<el-table-column label="退款金额" prop="buyCount"  />
					<el-table-column label="退款状态" prop="buyCount"  />
					<el-table-column label="审批人" prop="buyCount"  />
					<el-table-column label="转账人" prop="buyCount"  />
					<el-table-column label="审批时间" prop="buyCount"  />
					<el-table-column label="退款备注" prop="buyCount"  /> 
					
					<el-table-column label="操作">
						<template #default="scope">
							<el-link :underline="false" type="primary" @click="previewInfo(scope.row.id)">详情</el-link>
						</template>
					</el-table-column>
					
				</el-table>

				<section class="mt15">
					<el-row justify="end">
						<el-col :span="24" class="flex-end-center">
							<el-pagination
							v-model:current-page="state.param.pageNum"
							v-model:page-size="state.param.pageSize"
							:page-sizes="[10, 20, 30]"  
							:background="true"
							layout="total, sizes, prev, pager, next, jumper"
							:total="state.param.total"
							@size-change="handleSizeChange"
							@current-change="handleCurrentChange"
							/>
						</el-col>
					</el-row> 
				</section>
			</el-card>
		</section>
		<OrderInfo v-show="status" :back="hidenOrderInfo" />
		<CardDialog v-model="cardDialogVisble" :id="state.param.rowId" :status="status" />
	</div>
</template>

<script setup lang="ts" name="funCountup">
import {  onMounted, reactive, ref } from 'vue';
import CardDialog from '/@/views/finance/refundTransfer/components/CardDialog.vue' 
import OrderInfo from '/@/views/finance/refundTransfer/components/OrderInfo.vue' 
import type { storeNodeListData, channelListData } from "/@/types/order";

const state = reactive({
	dialogTitle: '',
	param: {
		dateTime: '',
		store: '',
		total: 0, 
		pageNum: 1,
		pageSize: 10,
		rowId: 0,  
		businessCode: '',
		refundStatus: ''
	},
	query: { 
		storeList: [] as Array<storeNodeListData>,
		refundStatus: [
			{ label: '全部', value: null },
			{ label: '转账中', value: 1 },
			{ label: '已转账', value: 2 },
		]
	},  
	loading: false,
	total: 0,
	tableData: [
		{
			id: 1,
			cardItemName: '测试',
			property: '属性名称',
			spec: '规格',
			salesVolume: '销量',
			cellPrice: '销售价格', 
			orderPrice: '销售金额',
			buyCount: '购买人数',
			coverRatio: '客户覆盖率',
			performanceRatio: '业绩占比',
			allRatio: '全款率',
			startTime: '2023-12-22 12:36:54',
			endTime: '2023-12-22 12:36:54', 
			status: '活动状态',
		}
	] as Array<any>
		
});

const cardDialogVisble = ref(false)
const status = ref(false)

const search = () => {}

const handleSizeChange = () => {}
const handleCurrentChange = () => {}
const previewInfo = (row: any) => { 
	state.param.rowId = row.id
	cardDialogVisble.value = true
	// state.dialogTitle = row.cardItemName || ''
}
const previewOrderInfo = (row: any) => {
	status.value = true
	state.param.rowId = row.id 
}

const hidenOrderInfo = () => status.value = false;

// 页面加载时
onMounted(() => {
});
</script>

<style scoped lang="scss">
</style>
